#define _POSIX_C_SOURCE 199309
#include <signal.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
  int sig, numSigs, j, sigData;
  union sigval sv;
  pid_t pid;
  if (argc < 4 || strcmp(argv[1], "--help") == 0)
    printf("usage: %s pid sig-num data",argv[0]);
  printf("%s: PID is %d, UID is %d\n", argv[0], getpid(), getuid());
  sig = atoi(argv[2]);
  pid = (pid_t)atoi(argv[1]);
  sigData = atoi(argv[3]);
  
  if (sigqueue(pid,sig,sv) == -1)
    printf("Failed to send signal %d to process %d\n", sig, (int)pid);
  return 0;
}
